package com.timedomain.him.remake.models;

import com.timedomain.him.remake.core.ChannelCreator;
import com.timedomain.him.remake.core.SimplePlayer;
import com.timedomain.him.remake.utils.FileUtils;
import com.timedomain.him.remake.utils.TimeUtils;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class CompanionPhoneCall {
    public int id;
    public String title;
    public String path;
    public long date;
    public String duration;


    public CompanionPhoneCall(int id, String title, String path, long date, String duration) {
        this.id = id;
        this.title = title;
        this.path = path;
        this.date = date;
        this.duration = duration;
    }


    public CompanionPhoneCall(String title, String path, long date, String duration) {
        this.id = -1;
        this.title = title;
        this.path = path;
        this.date = date;
        this.duration = duration;
    }

//    public static CompanionPhoneCall fromPath(String path){
//        long date = TimeUtils.getTimeStampIgnoreTimeZone();
//        String title = FileUtils.getFileNameWithoutExtension(path);
//        SimplePlayer simplePlayer = new SimplePlayer(ChannelCreator.FromFile(path));
//        long duration_i64 = simplePlayer.getDuration();
//        simplePlayer.close();
//        int durationMinute = (int) (duration_i64 / 60000);
//        int durationSecond = (int)((duration_i64 % 60000) / 1000);
//        String duration = durationMinute+"分"+durationSecond+"秒";
//
//        return new CompanionPhoneCall(title,path,TimeUtils.getTimeStampIgnoreTimeZone(),duration);
//    }
}
